﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.Windows;
using Autodesk.AutoCAD.Geometry;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using Newtonsoft.Json;
using System.Reflection;

namespace cadbom
{
    class BaigeCreateProduct
    {
        BomForm bomForm;
        private void BomForm_FormClosed(object sender, FormClosedEventArgs e)
        {
            // 当窗口关闭时，将Form 设置为 null
            bomForm = null;
        }
        private void BaigeInsertTable()
        {
            MessageBox.Show(" insert table....");
            LogHelper.WriteLog("开始创建表格！");
            Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
            Editor editor = doc.Editor;
            GValues.clickButtonText = "插入";
            if (bomForm == null)
            {
                // 创建 Windows Form 窗口
                bomForm = new BomForm();
                bomForm.FormClosed += BomForm_FormClosed;
                //bomForm.Disposed += BomForm_Disposed;
            }
            //bomForm.WindowState = FormWindowState.Normal;
            //InitDomainConfig();
            //getUserInfo();

            // 显示 Windows Form 窗口
            Autodesk.AutoCAD.ApplicationServices.Application.ShowModelessDialog(null, bomForm);
            bomForm.initBomFromData();
        }
       


    }
}
